package gamesrv.server.impl;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import javax.management.openmbean.*;


public class GameInfo {
	GameContainer game;
	
	public GameInfo(GameContainer game)
	{
		this.game = game;
	}
	
	public String[] getUsers()
	{
		String[] list = new String[game.getUserCount()];
		
		for(int i=0; i < game.getUserCount(); i++)
			list[i]=(game.getUserName(i));
		
		return list;
	}
	
	public String getScore()
	{
		return game.getScore();
	}
	
	public String[] getSituation()
	{		
		String[][] situation = game.getSituation();
		String[] output = new String[situation.length];
		for (int i=0; i < output.length; i++)
			output[i]= Arrays.toString(situation[i]);
		return output;
	}
	/*
	public TabularData getSituationTabular() throws OpenDataException
	{
		String[][] situation = game.getSituation();
		
		String[] colNames = {"c1","c2","c3"};
		CompositeType cType =  new CompositeType("rowtype","dd",colNames,colNames,new OpenType[]{SimpleType.STRING,SimpleType.STRING,SimpleType.STRING});
		TabularType tType = new TabularType("dd", "ddd",cType,colNames );		
		TabularDataSupport data = new TabularDataSupport(tType);  
		
		for (int i=0; i < 3; i++)
		{
			CompositeDataSupport row = new CompositeDataSupport(cType, colNames, situation[i]);
			data.put(row);
		}
		
		return data;
	}
	*/
	
}
